

	$("#seekMedicalHelp").click(function(){	//点击寻求医疗帮助
		ChangeTo($("#more"));
		$("h1").text("寻求医疗帮助");
		$("#seekMedicalHelpPost").show().siblings().hide();
		$('#seekMedicalHelpPost #postPublishBtn').unbind();
		$("#seekMedicalHelpPost #postPublishBtn").click(function(){
			var theme=$('#seekMedicalHelpPost #theme').val();
			var effective_date=$("#seekMedicalHelpPost #effectiveDate").val();
			var content=$("#seekMedicalHelpPost #content").val();
			doSeekHelpPost(theme,effective_date,content,'S10');	//访问API,
		})
		$('#seekMedicalHelpPost #prevBtn').unbind();
		$('#seekMedicalHelpPost #prevBtn').click(function(){
			showMoreFun();
		})
	});
	$("#seekFinancialHelp").click(function(){	//点击寻求经济帮助
		ChangeTo($("#more"));
		$("h1").text("寻求经济帮助");
		$("#seekFinancialHelpPost").show().siblings().hide();
		$('#seekFinancialHelpPost #postPublishBtn').unbind();
		$("#seekFinancialHelpPost #postPublishBtn").click(function(){
			var theme=$('#seekFinancialHelpPost #theme').val();
			var effective_date=$("#seekFinancialHelpPost #effectiveDate").val();
			var content=$("#seekFinancialHelpPost #content").val();
			doSeekHelpPost(theme,effective_date,content,'S20');	//访问API,
		})
		$('#seekFinancialHelpPost #prevBtn').unbind();
		$('#seekFinancialHelpPost #prevBtn').click(function(){
			showMoreFun();
		})
	});
	$("#provideMedicalHelp").click(function(){	//点击提供医疗帮助
		ChangeTo($("#more"));
		$("h1").text("提供医疗帮助");
		$("#provideMedicalHelpPost").show().siblings().hide();	
		$('#provideMedicalHelpPost #postPublishBtn').unbind();
		$("#provideMedicalHelpPost #postPublishBtn").click(function(){
			var theme=$('#provideMedicalHelpPost #theme').val();
			var effective_date=$("#provideMedicalHelpPost #effectiveDate").val();
			var content=$("#provideMedicalHelpPost #content").val();
			doProvideHelpPost(theme,effective_date,content,'P10');	//访问API,	
		})
		$('#provideMedicalHelpPost #prevBtn').unbind();
		$('#provideMedicalHelpPost #prevBtn').click(function(){
			showMoreFun();	
		})
	});
	$("#donation").click(function(){	//点击捐款
		ChangeTo($("#more"));
		$("h1").text("捐款");
		$("#donationPost").show().siblings().hide();
		getFunds();			//获取慈善基金名称
		$('#donationPost #postPublishBtn').unbind();
		$("#donationPost #postPublishBtn").click(function(){
			doDonationPost();	//访问API,	
		})
		$('#donationPost #prevBtn').unbind();
		$('#donationPost #prevBtn').click(function(){
			showMoreFun();
		})
	});
	
	function doSeekHelpPost(theme,effective_date,content,post_type){	//访问API
		var postData={"theme":theme,"effective_date":effective_date,"content":content,'post_type':post_type};
		request("POST", "/doSeekHelpPost", postData, doSeekHelpPostSuccess, doSeekHelpPostError, true);
		function doSeekHelpPostSuccess(responseData){
			if(responseData.code=="1200")		//提交成功
				alert(responseData.description);
			else
				alert(responseData.description);
		}
		function doSeekHelpPostError(){}
	}

	function doProvideHelpPost(theme,effective_date,content,post_type){	//访问API
		var postData={"theme":theme,"effective_date":effective_date,"content":content,'post_type':post_type};
		request("POST", "/doProvideHelpPost", postData, doProvideHelpPostSuccess, doProvideHelpPostError, true);
		function doProvideHelpPostSuccess(responseData){
			if(responseData.code=="1300")		//提交成功
				alert(responseData.description);
			else
				alert(responseData.description);
		}
		function doProvideHelpPostError(){}
	}
	
	function doDonationPost(){	//访问API
		var amount=$('#amount');
		var id=$("#fundNames").find("option:selected").attr('id');
		var comment=$("#donationPost #comment").text();
		var postData={"fund_id":id,"amount_of_money":amount,"comment":comment};
		request("POST", "/doDonationPost", postData, doDonationPostSuccess, doDonationPostError, true);
		function doDonationPostSuccess(responseData){
			if(responseData.code=="1000")		//提交成功
				alert(responseData.description+"，请支付...");
			else
				alert(responseData.description);
		}
		function doDonationPostError(){}
	}
	
	function getFunds(){	//访问API
		request("GET", "/getFunds", {}, getFundsSuccess, getFundsError, true);
		function getFundsSuccess(responseData){
			if(responseData.code=="1000")		//获取成功
			{
				var fundNames=$("#fundNames");
				var option=$("<option>");		//创建option标签
				var funds=responseData.data;
				for(var i=0;i<funds.length;i++){	/*添加五张图片*/
					//添加图片
					var fund_name=funds[i].fund_name;
					var fund_id=funds[i].fund_id;
					var option_clone=option.clone();
					option_clone.addClass('input');
					option_clone.attr("id",fund_id);
					option_clone.text(fund_name);
					fundNames.append(option_clone);
				}
			}
			else
			{
				alert(responseData.description);	
			}
		};
		function getFundsError(){}
	}